import * as veeValidata from "vee-validate"
import  {required,email,min,max} from "@vee-validate/rules"
import  rules from "@vee-validate/rules"
import { loadLocaleFromURL, localize } from '@vee-validate/i18n';

import yup from "./yup"

import zh_CN from '@vee-validate/i18n/dist/locale/zh_CN.json'
veeValidata.configure({
    generateMessage:localize("zh-CN",zh_CN),
    //其他的配置
    // validateOnBlur
})

    Object.keys(rules).forEach(key=>{
         //批量定义规则
         veeValidata.defineRule(key,rules[key])
    })

    //定义为响应式数据
    const useFields=(fields:string[])=>{
        fields.forEach((field)=>veeValidata.useField(field))
         }

    const modules ={yup,...veeValidata,useFields}

    //导出规则
    export default modules